home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Toolbox
/
Visual Basic Toolbox (P.I.E.)(1996).ISO
/
printing
/
iprint
/
colordem.fr_
/
colordem.fr
Wrap
Text File
|
1994-08-03
|
4KB
|
123 lines
VERSION 2.00
Begin Form ColorDemoForm
BackColor = &H00FFFFFF&
Caption = "Color Demo"
ClientHeight = 4020
ClientLeft = 1095
ClientTop = 1485
ClientWidth = 7365
Height = 4425
Left = 1035
LinkTopic = "Form1"
ScaleHeight = 4020
ScaleWidth = 7365
Top = 1140
Width = 7485
Begin CommandButton FontButton
Caption = "&Fonts"
Height = 495
Left = 5700
TabIndex = 5
Top = 2400
Width = 1095
End
Begin CommandButton ExitButton
Cancel = -1 'True
Caption = "E&xit"
Height = 495
Left = 5700
TabIndex = 3
Top = 3060
Width = 1095
End
Begin PictureBox ColorBox
BackColor = &H00FFFFFF&
Height = 495
Index = 0
Left = 360
ScaleHeight = 465
ScaleWidth = 525
TabIndex = 0
Top = 240
Width = 555
End
Begin Shape ColorBoxBorder
Height = 615
Index = 0
Left = 300
Top = 180
Visible = 0 'False
Width = 675
End
Begin Label HexColorLabel
AutoSize = -1 'True
Height = 195
Left = 360
TabIndex = 4
Top = 2280
Width = 75
End
Begin Label RGBColorLabel
AutoSize = -1 'True
Height = 195
Left = 360
TabIndex = 2
Top = 2700
Width = 75
End
Begin Label QBColorLabel
AutoSize = -1 'True
Height = 195
Left = 360
TabIndex = 1
Top = 3120
Width = 75
End
End
Option Explicit
Sub ColorBox_Click (index As Integer)
Dim i As Integer
'Set the color labels to the correct values for the selected color.
QBColorLabel.Caption = "This color is QBColor: " + Format$(index)
RGBColorLabel.Caption = "This color is RGB color: " + Format$(ColorBox(index).BackColor)
HexColorLabel.Caption = "This color is Hexadecimal color: &&H" + Hex$(ColorBox(index).BackColor)
'Remove the highlight for the previously selected box.
For i = 0 To 15
If ColorBoxBorder(i).Visible = True Then
ColorBoxBorder(i).Visible = False
Exit For
End If
Next i
'Highlight the selected box.
ColorBoxBorder(index).Visible = True
End Sub
Sub ExitButton_Click ()
End
End Sub
Sub FontButton_Click ()
ColorDemoForm.Hide 'Hide the ColorDemoForm.
FontDemoForm.Show 'Show the FontDemoForm.
End Sub
Sub Form_Load ()
Dim i As Integer
Dim BoxTop As Integer
Dim BoxLeft As Integer
MousePointer = 11
'Draws and positions 16 boxes on the form.
BoxTop = ColorBox(0).Top 'Find the position of the first box in the control array in the top left corner of the form.
BoxLeft = ColorBox(0).Left
For i = 1 To 15
Call LoadColorBox(i, BoxTop, BoxLeft) 'Draw the next box and fill it with color.
BoxTop = ColorBox(i).Top 'Find the position of the box just drawn.
BoxLeft = ColorBox(i).Left
Next i
ColorBox(0).BackColor = QBColor(0) 'Set the color of the first box.
Call ColorBox_Click(0) 'Highlight the first box.
MousePointer = 0
End Sub